package com.paic.mhis.hcpms.common.base.dto;

import java.util.HashMap;
import java.util.Map;

/**
 * 分页
 * @author EX-CHENZHIYUAN001
 *
 */
public class PaginatedQueryDTO extends BaseDTO {
	private static final long serialVersionUID = 6035306812741325072L;

	public PaginatedQueryDTO(){
		
	}	
	//总记录数
	private int total=20;
	//每页记录数
	private int limit = 20;
	//记录开始（不包含）
	private int start=0;
	//记录结束（包含）
	private int end=0;
	//是否查询总数
	private Boolean doCount = false;
	//是否查询所有记录
	private Boolean queryAll = false;
	
	private Map<String,Object> queryMap = null;
	
	private Map<String,Object> param = new HashMap<String, Object>();
	public int getTotal() {
		return total;
	}
	public void setTotal(int total) {
		this.total = total;
	}
	public Boolean getDoCount() {
		return doCount;
	}
	public void setDoCount(Boolean doCount) {
		this.doCount = doCount;
	}
	public Boolean getQueryAll() {
		return queryAll;
	}
	public void setQueryAll(Boolean queryAll) {
		this.queryAll = queryAll;
	}
	public int getLimit() {
		return limit;
	}
	public void setLimit(int limit) {
		this.limit = limit;
	}
	public int getStart() {
		return start;
	}
	public void setStart(int start) {
		this.start = start;
	}
	public void setEnd(int end) {
		this.end = end;
	}
	public int getEnd() {
		return end==0?(getStart()/getLimit()+1)*getLimit():end;
	}
	
	public Map<String,Object> getQueryMap(){
		this.queryMap = new HashMap<String, Object>();
		this.queryMap.put("start", getStart());
		this.queryMap.put("end", getEnd());
		this.queryMap.put("doCount", getDoCount());
		this.queryMap.put("queryAll", getQueryAll());
		return this.queryMap;
	}
	public Map<String, Object> getParam() {
		return param;
	}
	public void setParam(Map<String, Object> param) {
		this.param = param;
	}
}
